/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.ufba.lasid.cloud;

import br.ufba.lasid.virt.IHypervisor;
import java.util.ArrayList;
import java.util.List;

/**
 *
 * @author aliriosa
 */
public class Node {

    private String address;
    private List<IHypervisor> hypervisors;
    private IHypervisor defaultHypervisor;

    public Node() {
    }

    public Node(String address) {
        this.address = address;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public List<IHypervisor> getHypervisors() {
        return hypervisors;
    }

    public void setHypervisors(List<IHypervisor> hypervisors) {
        this.hypervisors = hypervisors;
    }

    public void addHypervisor(IHypervisor hypervisor, boolean isDefault) {
        if (this.hypervisors == null) {
            this.hypervisors = new ArrayList<IHypervisor>();
        }
        hypervisor.setURI(address);
        this.hypervisors.add(hypervisor);
        if (isDefault) {
            this.defaultHypervisor = hypervisor;
        }
    }

    public IHypervisor getDefaultHypervisor() {
        return defaultHypervisor;
    }

    public void setDefaultHypervisor(IHypervisor defaultHypervisor) {
        this.defaultHypervisor = defaultHypervisor;
    }
}
